package com.sense.kukoo.common.utils;


import java.util.regex.Pattern;

//todo setImageWithRadius
public final class ImageAdapter {


    private static final String TAG = "ImageAdapter";

    /*@BindingAdapter(value = {"url","radiusAdapter", "placeholderRes"}, requireAll = false)
    public static void setImageWithRadius(ImageView imageView, String url, int radiusAdapter, int placeholderRes) {
        IImageSceneRequest<GlideConfig> imageSceneRequest = null;
        if (!TextUtils.isEmpty(url)) {
            if (isNumeric(url)){
                int resId = Integer.parseInt(url);
                if (resId > 0){
                    imageSceneRequest = Monet.get(imageView.getContext()).load(resId);
                }
            }else{
                imageSceneRequest = Monet.get(imageView.getContext()).load(url);
            }
        }
        if (imageSceneRequest != null && radiusAdapter > 0 ){
            GlideRoundTransform glideRoundTransform = new GlideRoundTransform(imageView.getContext(), radiusAdapter);
            imageSceneRequest = imageSceneRequest.<GlideConfig>transform(glideRoundTransform);
        }

        if (imageSceneRequest != null && placeholderRes > 0 ) {
            imageSceneRequest.placeholder(placeholderRes);
        }

        if (imageSceneRequest == null){
            return;
        }
        imageSceneRequest.into(imageView);
    }*/

    public static boolean isNumeric(String str){
        Pattern pattern = Pattern.compile("[0-9]*");
        return pattern.matcher(str).matches();
    }

}

